<?php

$action = "";
if (isset($_REQUEST['action']))
	$action = $_REQUEST['action'];

$start = "";
if (isset($_REQUEST['start']))
	$start = $_REQUEST['start'];

$tuser = "";
if (isset($_REQUEST['tuser']))
	$tuser = $_REQUEST['tuser'];

$qtest = "";
if (isset($_REQUEST['qtest']))
	$qtest = $_REQUEST['qtest'];


@session_start();
	require_once('toath/twitteroauth/twitteroauth.php');
	require_once('toath/config.php');

if ($action == "unfollow")
{
	if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret']))
	{
	}
	else
	{
		/* Get user access tokens out of the session. */
		$access_token = $_SESSION['access_token'];
		$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
		
		$connection->post('blocks/create', array('user_id' => $tuser));

	}

}
else if ($action == "reportspam")
{
	if (empty($_SESSION['access_token']) || empty($_SESSION['access_token']['oauth_token']) || empty($_SESSION['access_token']['oauth_token_secret']))
	{
	}
	else
	{
		/* Get user access tokens out of the session. */
		$access_token = $_SESSION['access_token'];
		$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
		
		$connection->post('report_spam', array('user_id' => $tuser));

	}
}

header("Location:index.php?start=$start&qtest=$qtest");
?> 
